package metier.Service;

import java.util.List;

import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import metier.entities.Ville;
import metier.sess.IVilleLocal;


@Stateless
@WebService
public class VilleService {
	
	@EJB(beanName="Ville")
	private IVilleLocal metier;
	
	
	@WebMethod
	public void addVille(@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean statut)
	{
		Ville v=new Ville(Initule, statut);
		metier.addVille(v);
	}
	
	@WebMethod
	public List<Ville> listVille()
	{
		return metier.getAllVille();
	}
	
	@WebMethod 
	public Ville getVille(@WebParam(name="Id")Integer Id)
	{
		return metier.getVille(Id);
	}
	
	
	@WebMethod
	public void UpdateVille(@WebParam(name="Id")Integer Id,@WebParam(name="Intitule")String Intitule,@WebParam(name="Statut")boolean statut)
	{
	
		Ville v=metier.getVille(Id);
		v.setIntitule(Intitule);
		v.setStatut(statut);
		metier.updateVille(v);
		
	}
	
	@WebMethod
	public void DeleteVille(@WebParam(name="Id")Integer Id)
	{
		metier.deleteVille(Id);
	}
	
	
	

}
